home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 November / Chip_2004-11_cd1.bin / zkuste / planetaria / download / celestia / celestia-win32-1.3.2.exe / {app} / shaders / bumpdiffuse_nv.fp < prev    next >
Text File  |  2004-03-17  |  739b  |  38 lines

  1. !!FP1.0
  2.  
  3. # Diffuse bump map + texture
  4. # Base texture in tex 0
  5. # Normal map in tex 1
  6.  
  7. # Ambient color in constant 5
  8.  
  9. # Get the base texture color
  10. TEX H0, f[TEX0], TEX0, 2D;
  11.  
  12. # Get the normal map value
  13. TEX H1, f[TEX1], TEX1, 2D;
  14.  
  15. # Unpack the unsigned texture components into a normal
  16. MADX H1, H1, 2.0, -1.0;
  17.  
  18. # The diffuse color contains the tangent space normal; unpack it into H2
  19. MADX H2, f[COL0], 2.0, -1.0;
  20.  
  21. # Compute the diffuse term
  22. DP3X H3.w, H1, H2;
  23.  
  24. # Compute the self shadowing term--multiplying by a factor of 8 gives
  25. # a steep ramp function
  26. MULH_SAT H1.w, H2.z, 8.0;
  27.  
  28. # Add the product of the diffuse and self shadowing terms to the
  29. # ambient color.
  30. MADX H3.xyz, H1.w, H3.w, p[5];
  31.  
  32. MULX H0.xyz, H3, H0;
  33.  
  34. MOVX o[COLR], H0;
  35.  
  36. END
  37.  
  38.